
from fastapi import APIRouter
from ..utils.database import SessionLocal
from ..model.slave import AI


router = APIRouter()

@router.get('/ai')
async def ai():
    all_ai_hosts = []
    with SessionLocal() as session:
        ais = session.query(AI).filter_by(del_flag="0").all()
        for ai in ais:
            all_ai_hosts.append([ai.hostname, ai.ai_name])
        return {"all_ai_hosts": all_ai_hosts}